package com.google.code.chaotic.dto;

import java.io.Serializable;
import java.util.Date;

//

public class HabitInServiceDto implements Serializable {

	/**
	 * @uml.property name="service"
	 * @uml.associationEnd 
	 *                     inverse="habits:com.google.code.chaotic.dto.CommutingServiceDto"
	 */
	private CommutingServiceDto service;

	private String serviceId;

	private CommutingHabitDto habit;

	private String habitId;

	private String cancellingCode;

	private boolean cancelled;

	private Date cancellationTime;

	//

	/** @uml.property name="service" */
	public CommutingServiceDto getService() {
		return service;
	}

	/** @uml.property name="service" */
	public void setService(CommutingServiceDto service) {
		this.service = service;
		serviceId = (service != null ? service.getId() : null);
	}

	/** @uml.property name="serviceId" */
	public String getServiceId() {
		return service != null ? service.getId() : serviceId;
	}

	/** @uml.property name="serviceId" */
	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
		if (service != null && !service.getId().equals(serviceId))
			service = null;
	}

	/** @uml.property name="habit" */
	public CommutingHabitDto getHabit() {
		return habit;
	}

	/** @uml.property name="habit" */
	public void setHabit(CommutingHabitDto habit) {
		this.habit = habit;
	}

	/** @uml.property name="habitId" */
	public String getHabitId() {
		return habit != null ? habit.getId() : habitId;
	}

	/** @uml.property name="habitId" */
	public void setHabitId(String habitId) {
		this.habitId = habitId;
		if (habit != null && !habit.getId().equals(habitId))
			habit = null;
	}

	public void setCancellingCode(String code) {
		this.cancellingCode = code;
	}

	public String getCancellingCode() {
		return cancellingCode;
	}

	public void setCancellationTime(Date time) {
		this.cancellationTime = time;
	}

	public Date getCancellationTime() {
		return cancellationTime;
	}
}
